using System;
using System.Data;
using System.Collections.Generic;
namespace eTMS.DAO{
	/********************************BEGIN GiayToSinhVienDAO****************************************/
	///<summary>
	/// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
	/// <para>Date:10/08/2010 58:03:30</para>
	/// <para>Class Name: GiayToSinhVienDAO</para>
	/// <para>Description: Class access to table GiayToSinhVien in database. Class for coder code here</para>
	///</summary>

	
	public partial class GiayToSinhVienDAO{
        public bool DeleteByLoaiGiayToListSinhVien_ID(List<int> lsSinhVien_ID, int LoaiGiayTo_ID)
        {
            IDbCommand cmd = this.CreateCommand();
            cmd.CommandText = "Delete from GiayToSinhVien WHERE LoaiGiayTo_ID="+LoaiGiayTo_ID.ToString()+" AND SinhVien_ID IN("+string.Join(",",lsSinhVien_ID.ConvertAll<string>(Convert.ToString).ToArray())+")";
            return this.ExcuteNoneQuery(cmd);
        }
        public DataSet SelectAllDSWithLoaiGiayTo(int SinhVien_ID)
        {
            IDbCommand cmd = this.CreateCommand();
            cmd.CommandText = @"SELECT        GiayToSinhVien.*,LoaiGiayTo.MaLoaiGiayTo, LoaiGiayTo.TenLoaiGiayTo
FROM            GiayToSinhVien INNER JOIN
                         LoaiGiayTo ON GiayToSinhVien.LoaiGiayTo_ID = LoaiGiayTo.LoaiGiayTo_ID WHERE SinhVien_ID="+SinhVien_ID.ToString();
            return this.SelectDS(cmd);
        }
        public bool UpdateByLoaiGiayToListSinhVien_ID(List<int> lsSinhVien_ID, int LoaiGiayTo_ID,bool IsDaTra,DateTime NgayTra)
        {
            IDbCommand cmd = this.CreateCommand();
            cmd.CommandText = "Update GiayToSinhVien Set DaTra=@DaTra,NgayTra=@NgayTra WHERE LoaiGiayTo_ID=" + LoaiGiayTo_ID.ToString() + " AND SinhVien_ID IN(" + string.Join(",", lsSinhVien_ID.ConvertAll<string>(Convert.ToString).ToArray()) + ")";
            this.CreateCommandParameter(cmd,"@DaTra",IsDaTra);
            this.CreateCommandParameter(cmd, "@NgayTra", NgayTra);
            return this.ExcuteNoneQuery(cmd);
        }
        
	}
	/*****************************************************************************************************/
	/**********************************END GiayToSinhVienDAO*****************************************/
	/*****************************************************************************************************/
}

